package Controller.Member;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import Bean.MemberBean;
import Dao.MemberDao;

public class MemberidCheck implements Controller{
	private MemberDao member;

	public void setMember(MemberDao member) {
		this.member = member;
	}
	@Override
	public ModelAndView handleRequest(HttpServletRequest req,
			HttpServletResponse res) throws Exception {
		
		String m_id = req.getParameter("m_id");
		String comment="";
		System.out.println(m_id);
		MemberBean bean = new MemberBean();
		bean.setM_id(m_id);
		int result = member.mCheckid(bean);
		System.out.println( "result 결과 : "+result);
		if(result == -1){
			comment="사용 가능합니다.";
		}
		else if(result == 1){
			comment="사용중인 아이디 입니다.";
		}
		
		System.out.println(comment+" comment 체크");
		return new ModelAndView("CheckedID", "comment", comment);
	}
}
